//
//  KKLiveMessageSendingTipView.m
//  KKLiveDemo
//
//  Created by leo on 2017/7/30.
//  Copyright © 2017年 leo. All rights reserved.
//

#import "KKLiveMessageSendingTipView.h"
#import "KKLiveHelper.h"
#import "KKMessageItem.h"

@implementation KKLiveMessageSendingTipView

- (instancetype)init {
    self = [super init];
    if (self) {
        _btn_error = [UIButton buttonWithType: UIButtonTypeCustom];
        [_btn_error setImage: [KKLiveHelper kk_chatImageWithName: @"message_send_failed"] forState: UIControlStateNormal];
        _btn_error.hidden = YES;
        [self addSubview:_btn_error];
        
        _sending = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
        _sending.hidesWhenStopped = YES;
        [self addSubview:_sending];
    }
    return self;
}

//  设置消息的发送状态
- (void)setMessageStatus:(NSInteger)status {
    
    switch (status) {
        case KKMessageStatus_Init:
        case KKMessageStatus_WillSending:
        {
            //  TODO:
        }
        break;
        case KKMessageStatus_Sending:
        {
            _btn_error.hidden = YES;
            [_sending startAnimating];
        }
        break;
            case KKMessageStatus_SendSuccess:
        {
            _btn_error.hidden = YES;
            [_sending stopAnimating];
        }
            break;
        case KKMessageStatus_SendFail:
        {
            _btn_error.hidden = NO;
            [_sending startAnimating];
        }
            break;
        default:
            break;
    }
}

@end
